/**
 * 文章基本信息表
 *
 */
module.exports = app => {
	const { STRING, INTEGER, CHAR, Sequelize } = app.Sequelize;
	const SkillType = app.model.define(
		'skill_type',
		{
			id: {
				type: INTEGER,
				primaryKey: true,
				autoIncrement: true
			},
			skillId: {
				type: INTEGER,
				field: 'skill_id'
			},
			//文章标题
			typeName: {
				type: STRING(50),
				notNull: true,
				field: 'type_name'
			}
		},
		{
			timestamps: false, //去除createAt updateAt
			freezeTableName: true //使用自定义表名
		}
	);

	SkillType.associate = function() {
		app.model.SkillType.belongsTo(app.model.Skills, { foreignKey: 'skillId', targetKey: 'skillId' });
	};
	return SkillType;
};
